package com.scau.XFourPOS.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.springframework.stereotype.Repository;

import com.scau.XFourPOS.dao.ProductDao;
import com.scau.XFourPOS.model.Product;
import com.scau.XFourPOS.utils.PageUtils;

/**
 * 类名：ProductDaoImpl 类描述：商品的增删查改基本操作类 创建人：庄祥鹏
 * */
@Repository
public class ProductDaoImpl extends BaseDaoImpl<Product> implements ProductDao {

	@Override
	public Product loadByCode(String code) {
		Session session = getSession();
		Query query = session.createQuery("from Product u where u.code='"+code+"'");
		List<Product> productList=query.list();
		Product product=productList.get(0);
		return product;
	}

}
